Repository navigation
Automatically track source digests for all components - #2720
Open
joelhawksley wants to merge 6 commits into
Open
joelhawksley wants to merge 6 commits into
joelhawksley wants to merge 6 commits into
Conversation
Consolidate the fixes proposed in #2711 and #2713. Register literal and declared dependencies by their actual class names and virtual paths, preserving acronym names, custom paths, and transitive invalidation without enabling output caching or suppressing digest errors. Co-authored-by: Erik Axel Nielsen <erikaxel@lucalabs.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 62a65b38-1933-46c3-aa8b-de40801e2c7f
This was referenced Oct 9, 2026
Split the guide sentence flagged by Vale, remove directives for a Rails cop not loaded by StandardRB, and remove a redundant line continuation rejected by current RuboCop. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 62a65b38-1933-46c3-aa8b-de40801e2c7f
Install digest discovery at engine initialization and move component digest APIs and fragment key integration to Base. Track every component automatically while keeping cache_on output caching opt-in. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 62a65b38-1933-46c3-aa8b-de40801e2c7f
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 62a65b38-1933-46c3-aa8b-de40801e2c7f
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
Automatically integrate all ViewComponents into Rails' template digest tree. No module include or application-level opt-in is required for source dependency tracking,
.cache_digest, or digest-awarecacheblocks inside component templates.This consolidates and supersedes #2711 and #2713, building on Erik Axel Nielsen's fixes for silently incomplete cache digests. The scope was subsequently expanded to make digest tracking automatic for every component, eliminating the application-wide activation side effect of including
ExperimentallyCacheableon an unrelated component.What approach did you choose and why?
ViewComponent::Baseand share registration for literal renders and explicit# Template Dependency:declarations. Store actual class names and virtual paths rather than reconstructing names withcamelize, preserving acronym names and custom paths without retaining stale class objects across reloads..cache_digestand component-template fragment digest integration toViewComponent::Base. Direct digest computation also registers the component, including any overridden virtual path.ExperimentallyCacheablefocused on the opt-incache_onAPI. Automatic digest tracking does not automatically cache rendered output or addcache_onto all components.This intentionally changes the default for all applications: existing Rails fragment cache blocks involving components now include component source dependencies, even if no component includes the experimental caching module. Components without fragment blocks or
cache_ondo not start caching output.Anything you want to highlight for special attention from reviewers?
Regression coverage includes template and Ruby dependencies without caching opt-in, explicit declarations, transitive invalidation through a child with a custom virtual path to an acronym-named grandchild, actual fragment output after source changes, discovery starting from an empty registry, direct digest computation without prior registration, and autoload error propagation.
Component-hosted fragment fixtures no longer include the caching module, so existing exact-key, inherited-template, invalidation, and partial fall-through tests now exercise automatic behavior. The view fragment fixture renders only components without caching opt-in.
The sandbox's Zeitwerk inflector maps
http_untracked_componenttoHTTPUntrackedComponentwithout changing Active Support's global inflections, exercising names that cannot be recovered withpath.camelize.Validation:
git diff --checkpass..cache_digest.Erik is credited as a co-author for the original proposals and regression coverage.